cmake_minimum_required(VERSION 3.10)

#project(dlt645)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Os -fPIC")

aux_source_directory(./src SRC)

#include_directories
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../common/include)

#library_directories
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib)

#add_executable(dlt645 ${SRC}) # 生成可执行文件
#add_library(dlt645 STATIC ${SRC}) # 生成静态库
add_library(dlt645 SHARED ${SRC}) # 生成动态库或共享库
SET_TARGET_PROPERTIES(dlt645 PROPERTIES VERSION 1.0.0 SOVERSION 1)

#TARGET_LINK_LIBRARIES(dlt645 liblogger.so libcommon.so libdb.so)

install(TARGETS dlt645 LIBRARY DESTINATION ${CMAKE_LIBRARY_PATH})

add_custom_command(TARGET  dlt645
        POST_BUILD
        COMMAND echo "dlt645 builded finished."
        COMMAND ${CMAKE_STRIP} "$<TARGET_FILE:dlt645>"
#        COMMAND ${CMAKE_COMMAND} -E copy  $<TARGET_FILE:dlt645> ${CMAKE_LIBRARY_PATH}/libdlt645.so 
#        COMMENT  "dlt645 is install finished"
       )

